﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace GDF_kaart_inlezen
{
    class Reader
    {
        static readonly string url = @"nld01p0865.gdf";
        public List<Data> dataList = new List<Data>();
        public Bibliotheek bieb;
        public bool reading_done = false;
        public List<string> queue; 

        public Reader()
        {
            queue = new List<string>();
            bieb = new Bibliotheek(this);
        }


        public void Read()
        {
            bieb.StartThread();
            StreamReader sr = new StreamReader(url);
            while(true)
            {
                string line = sr.ReadLine();
                
                if (line == null)
                    break;
                while (line.Substring(line.Length - 1, 1).Equals("1"))
                {
                    line = line.Substring(0, line.Length - 1);
                    String newLine = sr.ReadLine();
                    line += newLine.Substring(2, newLine.Length - 2);
                }
                queue.Add(line);  
            }
            reading_done = true;
        }
    }
}
